<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>就业信息系统</title>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/css/main.css">
    <link rel="stylesheet" href="/static/admin/css/jquery.pagination.css">
    <script type="text/javascript" src="/static/admin/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="/static/admin/js/jquery.pagination.min.js"></script>
    <script type="text/javascript" src="/static/index/js/index.js"></script>
</head>
<body>
<div class="breadcrub">
    当前位置：用户管理>用户列表
</div>
<div class="pannel">
    <table class="common_table">
        <tr>
            <th>用户名</th>
            <th>电话</th>
            <th>管理员</th>
            <th>操作</th>
        </tr>
        {% for user in users %}
            <tr>
                <td>{{ user.username }}</td>
                <td>{{ user.phone }}</td>
                <td>{{ user.is_admin }}</td>

                {#            <td>winkx</td>#}
                {#            <td>15340851024</td>#}
                {#            <td>是</td>#}
                {#            <td>#}
                {#                    <a href="news_review_detail.html" class="review">添加</a>#}
                {#                <div><a href="/changeuser" class="review">删除</a></div>#}
                {#                <div><a href="/changeuser" class="review">修改</a></div>#}
                <td>
                    <span id="update" class="update" style="cursor: pointer"><a href="/changeuser/{{ user.id }}/">修改</a></span>
                    <span id="delete" class="delete" style="cursor: pointer" value="{{ user.id }}">删除</span>
                    {#                    <a href="/changeuser/{{ user.id }}/" class="review">修改</a>#}
                    {#                    <a href="" class="review" id="del" value="{{ user.id }}">删除</a>#}
                </td>

            </tr>
        {% endfor %}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        {#                <tr>#}
        {#                    <td>张大山</td>#}
        {#                    <td>13534888888</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                    <td>2018-2-28 23:07:26</td>#}
        {#                </tr>#}
        <tr>
            <td>
                <a href="/adduser" class="edit">添加</a>
            </td>
        </tr>
    </table>
</div>

<div class="box">
    <div id="pagination" class="page"></div>
</div>

{#<!-- jQuery -->#}
{#<script src="/static/register/js/jquery.min.js"></script>#}
{#<script src="/static/register/js/jquery-1.12.4.min.js"></script>#}
{#<script src="/static/register/js/jquery.form.min.js"></script>#}
{#<script src="/static/register/js/jquery.pagination.min.js"></script>#}
{#<!-- Bootstrap -->#}
{#<script src="/static/register/js/bootstrap.min.js"></script>#}
{#<!-- Placeholder -->#}
{#<script src="/static/register/js/jquery.placeholder.min.js"></script>#}
{#<!-- Waypoints -->#}
{#<script src="/static/register/js/jquery.waypoints.min.js"></script>#}
{#<!-- Main JS -->#}
{#<script src="/static/register/js/main.js"></script>#}


<script>
    $(function () {
        $("#pagination").pagination({
            currentPage: {{ users.page }},
            totalPage: {{ users.pages }},
            callback: function (current) {
                {#alert('ok!');#}
                window.location.href = "?page=" + current;
            }
        });
    });
</script>

<script>
    $(function () {
        //点击发送ajax请求
        $('.delete').click(function () {
            var id = $(this).attr("value");


            $.ajax({
                url: "/deleteuser_info/" + id + "/",
                type: "post",
                contentType: "application/json",
                // 响应数据的格式
                dataType: "json",
                {#data: JSON.stringify(params),#}
                success: function (resp) {
                    if (resp.code == "0") {
                        // 刷新当前界面
                        {#location.reload();#}
                        location.href = '/user_list';
                        {#history.go(-1);#}
                        {#location.reload();#}
                    } else {
                        alert(resp.errmsg);
                        {#$("#register-err").html(resp.errmsg);#}
                        {#$("#register-err").show();#}
                        {#$(".get_pic_code").attr("src", "/member/image_code?id=" + Math.random())#}
                    }
                }
            })
        });
    })
</script>

</body>
</html>